﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using slnNegocio;

namespace slnMetodosYEstandares
{
    public partial class frmEstudio : Form
    {
        public frmEstudio()
        {
            InitializeComponent();
        }

        private void frmEstudio_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            dt = AccesoLogica.listaOperador();
            lstOperador.DataSource = dt;
            lstOperador.DisplayMember = "nombre";
            lstOperador.ValueMember = "id";
       }

        private void chkVer_CheckedChanged(object sender, EventArgs e)
        {
             DataTable dt = new DataTable();
            dt = AccesoLogica.listaOperacion(Convert.ToInt32(lstOperador.SelectedValue));
            lstOperacion.DataSource = dt;
            lstOperacion.DisplayMember = "nombre";
            lstOperacion.ValueMember = "id";
        }

        private void lstOperador_SelectedIndexChanged(object sender, EventArgs e)
        {
            chkVer.Checked = false;
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnTotalHolgura_Click(object sender, EventArgs e)
        {
            double a=Double.Parse(txtNP.Text);
            double b = Double.Parse(txtFB.Text);
            double c = Double.Parse(txtFV.Text);
            double d = Double.Parse(txtE.Text);
            double holgura = a+d+c+d;

            lblHolgura.Text = holgura.ToString();

            if (AccesoLogica.insertarHolgura(a, b, c, d, holgura)) { };
            
        }

        private void lstCalificación_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstCalificacion.SelectedIndex == 1)
            {
                frmWesting westing = new frmWesting();
                westing.ShowDialog();

            }else{
                txtCalificacion.ForeColor = Color.Red;
            }
        }
    }
}
